package com.vrv.app.cyberspace.modules.sys.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.vrv.app.cyberspace.common.ddio.ApiV2Service;
import com.vrv.app.cyberspace.common.utils.JSONResult;
import com.vrv.app.cyberspace.modules.sys.entity.DailyReport;
import com.vrv.app.cyberspace.modules.sys.service.IDailyReportService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 每日零报告-前端控制器
 * </p>
 *
 * @author sm
 * @since 2017-12-15
 */
@Api(description="每日零日报")
@RestController
@RequestMapping("/sys/dailyReport")
public class DailyReportController extends BaseController {
    @Autowired
    IDailyReportService dailyReportService;

    @Autowired
    ApiV2Service apiV2Service;

    //每日零报告新增/修改---值班员
    @RequestMapping("/addupdate")
    public JSONResult addupdateDailyReport(DailyReport dailyReport) {
        return dailyReportService.addupdateDailyReport(dailyReport) > 0 ?
                JSONResult.renderSuccess() : JSONResult.renderError();
    }

    //每日零报告发布---值班员
    @RequestMapping("/release")
    public JSONResult releaseDailyReport(DailyReport dailyReport) {
        dailyReportService.releaseDailyReport(dailyReport);
        return JSONResult.renderSuccess();
    }

    //每日零报告删除---值班员
    @RequestMapping("/delete")
    public JSONResult deleteDailyReport(DailyReport dailyReport) {
        return dailyReportService.deleteDailyReport(dailyReport) > -1 ?
                JSONResult.renderSuccess() : JSONResult.renderError("报告已经发布,无法进行该操作!");
    }

    //每日零报告列表
    @RequestMapping("/list")
    public JSONResult listDailyReport(DailyReport dailyReport) {
        return JSONResult.renderSuccess(dailyReportService.listDailyReport(new Page<>(dailyReport.getPage(), dailyReport.getSize()), dailyReport));
    }

    //每日零报告详情--值班员&领导
    @RequestMapping("/detail")
    public JSONResult detailDailyReport(Integer id) {
        return JSONResult.renderSuccess(dailyReportService.detailDailyReport(id));
    }

    //每日零报告详情--地方及以下
    @RequestMapping("/detailSub")
    public JSONResult detailSubDailyReport(Integer fId) {
        return JSONResult.renderSuccess(dailyReportService.detailSubDailyReport(fId));
    }
}

